package com.example.hyg_veintype.activity;

import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;

import com.example.hyg_veintype.R;
import com.example.hyg_veintype.activity.account.login.LoginActivity;
import com.example.hyg_veintype.base.BaseVeinTypeActivity;
import com.example.hyg_veintype.constant.account.AccountConst;
import com.hyg.lib_base.mainUtils.StatusBarUtil;

/**
 * @author: yyw
 * time: 2020/12/21 15:21
 * desc:启动页
 */
public class SplashActivity extends BaseVeinTypeActivity {
    @Override
    protected int getLayoutId() {
        return R.layout.veintype_activity_splash;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        StatusBarUtil.setStatusBar(3, this, getResources().getColor(R.color.musicPrimary), 00, null, null,false);
        rlTop.setVisibility(View.GONE);
        AccountConst.getAccountData(this);
        if(TextUtils.isEmpty(AccountConst.token)){
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    LoginActivity.start(SplashActivity.this);
                    finish();
                }
            }, 2000);
        }else{
            new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    MainActivity.start(SplashActivity.this);
                    finish();
                }
            }, 2000);
        }
    }

    @Override
    public void onClick(View v) {

    }
}
